/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fhv.itb.mst2955.server.persistence;

import fhv.itb.mst2955.client.model.UpdateObject;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * A server-side Address Entity.
 */
@Entity
@Table(name = "Address")
@NamedQueries({@NamedQuery(name = "Address.findAll", query = "SELECT a FROM Address a"), @NamedQuery(name = "Address.findByCity", query = "SELECT a FROM Address a WHERE a.city = :city"), @NamedQuery(name = "Address.findById", query = "SELECT a FROM Address a WHERE a.id = :id"), @NamedQuery(name = "Address.findByStreet", query = "SELECT a FROM Address a WHERE a.street = :street"), @NamedQuery(name = "Address.findByZip", query = "SELECT a FROM Address a WHERE a.zip = :zip"), @NamedQuery(name = "Address.findByCountryID", query = "SELECT a FROM Address a WHERE a.countryID = :countryID")})
public class Address implements Serializable, UpdateObject {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "city")
    private String city;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "street")
    private String street;
    @Basic(optional = false)
    @Column(name = "zip")
    private String zip;
    @Basic(optional = false)
    @Column(name = "countryID")
    private int countryID;
    @Basic(optional = false)
    @Column(name = "versionNr")
    private int versionNr;

    public Address() {
    }


    public Address(Integer id) {
        this.id = id;
    }


    public Address(Integer id, String city, String zip, int countryID, int versionNr) {
        this.id = id;
        this.city = city;
        this.zip = zip;
        this.countryID = countryID;
        this.versionNr = versionNr;
    }


    public String getCity() {
        return city;
    }


    public void setCity(String city) {
        this.city = city;
    }


    public Integer getId() {
        return id;
    }


    public void setId(Integer id) {
        this.id = id;
    }


    public String getStreet() {
        return street;
    }


    public void setStreet(String street) {
        this.street = street;
    }


    public String getZip() {
        return zip;
    }


    public void setZip(String zip) {
        this.zip = zip;
    }


    public int getCountryID() {
        return countryID;
    }


    public void setCountryID(int countryID) {
        this.countryID = countryID;
    }


    public Integer getVersionNr() {
        return versionNr;
    }


    public void setVersionNr(Integer versionNr) {
        this.versionNr = versionNr;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }


    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Address)) {
            return false;
        }
        Address other = (Address) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }


    @Override
    public String toString() {
        return "fhv.itb.mst2955.server.Address[id=" + id + "]";
    }

}
